﻿#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using BreakOutBattles.Game;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace BreakOutBattles.Menus
{
    /// <summary>
    /// The main menu of the game.
    /// </summary>
    public class MainMenu : Menu
    {

        public MainMenu(Microsoft.Xna.Framework.Game game, SpriteBatch spriteBatch)
            : base(game, spriteBatch)
        { }
      
        /// <summary>
        /// Creates the menu items of this menu.
        /// </summary>
        public override void CreateMenu()
        {
            menuItems.Add(new MenuItem("Create Game", new Vector2(500, 200), new Action(CreateGameAction)));
            menuItems.Add(new MenuItem("Join Game", new Vector2(500, 250), new Action(JoinGameAction)));
            menuItems.Add(new MenuItem("Exit", new Vector2(500, 350), new Action(ExitGameAction)));
        }

        #region Main Menu Actions
        /// <summary>
        /// Sets the current game state to CREATE_GAME when the create game button has
        /// been pressed by the player.
        /// </summary>
        public void CreateGameAction()
        {
            GameState.CurrentState = GameStates.CREATE_GAME;
        }

        /// <summary>
        /// Sets the current game state to CONNECT when the connect button has
        /// been pressed by the player.
        /// </summary>
        public void JoinGameAction()
        {
            GameState.CurrentState = GameStates.JOIN_GAME;
        }

        /// <summary>
        /// Attempts to abort and terminate the game. triggered when the player pressed
        /// the exit button.
        /// </summary>
        public void ExitGameAction()
        {
            Game.Exit();
        }
        #endregion

    }
}
